<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String path = request.getContextPath();
    String basePath =
            request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
                    + path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta charset="UTF-8">
    <title>房屋租赁系统</title>
    <link rel="stylesheet" type="text/css" href="css/common.css"/>
    <link rel="stylesheet" type="text/css" href="css/main.css"/>
    <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
    <script type="text/javascript" src="js/libs/modernizr.min.js"></script>
    <script type="text/javascript" src="js/jquery.validate.min.js"></script>
    <style type="text/css">
        .insert-tab span {
            font-size: 16px;
        }
        .result-wrap {
            border-bottom: none;
        }

        .error {
            font-size: 13px;
            color: red;
        }
    </style>
    <script type="text/javascript">
        $().ready(function () {
            // 在键盘按下并释放及提交后验证提交表单
            $("#myform").validate({

                rules: {
                    name: {
                        required: true
                    },

                    phone: {
                        required: true

                    },
                    idcard: {
                        required: true

                    }

                },
                messages: {
                    name: {
                        required: "请填写真实姓名"
                    },
                    phone: {
                        required: "请填写正确的手机号"
                    },
                    idcard: {
                        required: "请填写身份证信息"
                    }
                }
            });
        })
    </script>
</head>
<body>
<div>
    <div class="result-title">
        <c:choose>
            <c:when test="${sessionScope.ulist.phone==null}">
                <h1 style="color: red">请先完善个人资料</h1>
            </c:when>
            <c:otherwise>
                <h1>个人资料</h1>
            </c:otherwise>
        </c:choose>
    </div>
    <div class="result-content">
        <div class="sidebar-title">
            <form action="/userlist/update.action" method="post" id="myform" name="myform"
                  enctype="multipart/form-data">
                <table class="insert-tab" width="100%">
                    <tbody>
                    <input type="hidden" name="id" value="${userlist.id}"/>
                    <input type="hidden" name="user_id" value="${sessionScope.user.id}"/>
                    <tr>
                        <th><i class="require-red">*</i>真实姓名：</th>
                        <td>
                            <c:choose>
                                <c:when test="${param.edit=='true'}">
                                    <input class="common-text required"
                                           value="${userlist.name}"
                                           id="name"
                                           name="name" size="50" type="text">
                                </c:when>
                                <c:when test="${param.edit!='true'}">
                                    <span>${userlist.name}</span>
                                </c:when>
                            </c:choose>
                        </td>
                    </tr>
                    <tr>
                        <th><i class="require-red">*</i>联系电话：</th>
                        <td>
                            <c:choose>
                                <c:when test="${param.edit=='true'}">
                                    <input class="common-text required"
                                           value="${userlist.phone}"
                                           id="phone"
                                           name="phone" size="50" type="text">
                                </c:when>
                                <c:when test="${param.edit!='true'}">
                                    <span>${userlist.phone}</span>
                                </c:when>
                            </c:choose>

                        </td>
                    </tr>
                    <tr>
                        <th><i class="require-red">*</i>身份证号：</th>
                        <td>
                            <c:choose>
                                <c:when test="${param.edit=='true'}">
                                    <input class="common-text required"
                                           value="${userlist.idcard}"
                                           id="idcard"
                                           name="idcard" size="50" type="text">
                                </c:when>
                                <c:when test="${param.edit!='true'}">
                                    <span>${userlist.idcard}</span>
                                </c:when>
                            </c:choose>
                        </td>
                    </tr>
                    <tr>
                        <th></th>
                        <td>
                            <c:choose>
                                <c:when test="${param.edit!='true'}">
                                    <input class="btn btn-primary btn6 mr10"
                                           onclick="javascript:window.location.href='/userlist/get.action?edit=true';"
                                           value="编辑"
                                           type="button">
                                    <input class="btn btn6" onclick="history.go(-1)" value="返回"
                                           type="button">
                                </c:when>
                                <c:when test="${param.edit=='true'}">
                                    <input class="btn btn-primary btn6 mr10" value="提交"
                                           type="submit">
                                    <input class="btn btn6" onclick="history.go(-1)" value="取消"
                                           type="button">
                                </c:when>
                            </c:choose>
                        </td>
                    </tr>
                    <tr>
                        <font id="error" color="red">${msg}</font>
                    </tr>
                    </tbody>
                </table>
            </form>
        </div>
    </div>
</div>
</body>
</html>